package com.dadie.dorm.controller;

import com.dadie.dorm.pojo.vo.DormbuildCountVO;
import com.dadie.dorm.service.IDormbuildService;
import com.dadie.dorm.service.impl.DormbuildServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import sun.security.jgss.HttpCaller;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/echarts")
public class EChartsServlet extends HttpServlet {
    private IDormbuildService dormbuildService=new DormbuildServiceImpl();
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        List<DormbuildCountVO> list = dormbuildService.selectDormbuildCount();
        resp.setContentType("text/html;charset=utf-8");
        ObjectMapper objectMapper=new ObjectMapper();
        objectMapper.writeValue(resp.getWriter(),list);
    }


}
